#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QOpenGLWidget>
#include <QOpenGLFunctions_3_3_Core>
#include <QElapsedTimer>
#include <QTimer>
#include <QOpenGLShaderProgram>
#include <QMouseEvent>
#include <QOpenGLTexture>
#include <QOpenGLFunctions>

#include <QOpenGLWidget>
#include <QOpenGLFunctions>
#include <QFileInfo>
#include <QOpenGLContext>
#include <QGLWidget>
#include <iostream>
#include "Shader.h"
#include "stb_image.h"

class MyGLWidget : public QOpenGLWidget, protected QOpenGLFunctions_3_3_Core
{
    Q_OBJECT

public:
    MyGLWidget(QWidget *parent = nullptr) : QOpenGLWidget(parent) {}
    virtual ~MyGLWidget();


    unsigned int loadTexture(const char *fileName, bool a=true);
protected:
    void initializeGL() override;

    void paintGL() override;

    void resizeGL(int w, int h) override;

    unsigned int texture2 = -1;//不能跟texture1在一块，不然没有显示，原因未知(疑内存泄漏)
private:
    unsigned int VAO;
    unsigned int VBO;
    unsigned int EBO;
    Shader *shader;
    unsigned int texture1 = -1;

};


#endif // WIDGET_H
